{include file="public/header"/}

<body>
<div class="pd-20">
	<form class="form form-horizontal" id="form-password-edit">
		<table class="table table-border table-bordered table-bg">
			<thead>
			<tr>
				<th colspan="2">修改密码</th>
			</tr>
			</thead>
			<tbody>
			<tr>
				<th class="text-r" width="30%">用户名：</th>
				<td><option value="">{$admin['name']}</option></td>

			</tr>

			<tr>
				<th class="text-r">新密码：</th>
				<td><input name="password" id="password" class="input-text" type="password" autocomplete="off" placeholder="设置密码" style="width: 350px;">
				</td>
			</tr>
			<tr>
				<th class="text-r">再次输入新密码：</th>
				<td><input name="password2" id="password2" class="input-text" type="password" autocomplete="off" placeholder="确认新密码"  style="width: 350px;">
				</td>
			</tr>
			<input type="hidden" name="id" value="{$admin['id']}">
			<tr>
				<th></th>
				<td>
					<button class="btn btn-primary radius" lay-submit lay-filter="formDemo"><i class="Hui-iconfont">&#xe632;</i> 提交</button>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
</div>

{include file="public/footer"/}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});

    $("#form-password-edit").validate({
        rules:{
            password:{
                required:true,
                minlength:2,
            },
            password2:{
                required:true,
                minlength:2,
                equalTo: "#password"
            },
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $(form).ajaxSubmit({
                type: 'POST',
                url: "adminEdit" ,
                success: function(data){
                    if (data.code == 403) {
                        layer.msg('修改失败！',{icon:2,time:1000});
                        return false;
                    }
                    if (data.code == 200){
                        layer.msg('修改成功！',{icon:1,time:1000});
                        setTimeout(function () {
                            window.parent.location.reload();
                            parent.layer.close();
                        },1000);
                    }
                },
            });
        }
    });
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>